home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / CIncludes / StdLib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-17  |  2.1 KB  |  126 lines  |  [TEXT/MPS ]

  1. /*
  2.     StdLib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDLIB__
  10. #define __STDLIB__
  11.  
  12. #ifndef __size_t__
  13. #define __size_t__
  14. typedef unsigned int size_t;
  15. #endif
  16.  
  17. #ifndef __wchar_t__
  18. #define __wchar_t__
  19. typedef short wchar_t;
  20. #endif
  21.  
  22. typedef struct {
  23.     int quot;            /* quotient */
  24.     int rem;            /* remainder */
  25. } div_t;
  26.  
  27. typedef struct {
  28.     long int quot;        /* quotient */
  29.     long int rem;        /* remainder */
  30. } ldiv_t;
  31.  
  32.  
  33. #ifndef NULL
  34. #define NULL 0
  35. #endif
  36.  
  37. #define EXIT_FAILURE 1
  38. #define EXIT_SUCCESS 0
  39.  
  40. #define RAND_MAX 32767
  41.  
  42. #define MB_CUR_MAX 1
  43.  
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif
  47.  
  48. /*
  49.  *    String conversion functions
  50.  */
  51.  
  52. double atof (const char *nptr);
  53. int atoi (const char *nptr);
  54. long int atol (const char *nptr);
  55. double strtod (const char *nptr, char **endptr);
  56. long int strtol (const char *nptr, char **endptr, int base);
  57. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  58.  
  59.  
  60. /*
  61.  *    Pseudo-random sequence generation functions
  62.  */
  63.  
  64. int rand (void);
  65. void srand (unsigned int seed);
  66.  
  67.  
  68. /*
  69.  *    Memory management functions
  70.  */
  71.  
  72. void *calloc (size_t nmemb, size_t size);
  73. void free (void *ptr);
  74. void *malloc (size_t size);
  75. void *realloc (void *ptr, size_t size);
  76.  
  77.  
  78. /*
  79.  *    Communication with the environment
  80.  */
  81.  
  82. void abort (void);
  83. int atexit (void (*func)(void));
  84. void exit (int status);
  85. char *getenv (const char *name);
  86. int system (const char *string);
  87.  
  88.  
  89. /*
  90.  *    Searching and sorting utilities
  91.  */
  92.  
  93. void *bsearch (const void *key, const void *base,
  94.                size_t nmemb, size_t size,
  95.                int (*compar)(const void *, const void *));
  96. void qsort (void *base, size_t nmemb, size_t size,
  97.             int (*compar)(const void *, const void *));
  98.  
  99.  
  100. /*
  101.  *    Integer arithmetic functions
  102.  */
  103.  
  104. int abs (int j);
  105. div_t div (int numer, int denom);
  106. long int labs (long int j);
  107. ldiv_t ldiv (long int numer, long int denom);
  108.  
  109.  
  110. /*
  111.  *    Multibyte functions
  112.  */
  113.  
  114. int mblen (const char *s, size_t n);
  115. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  116. int wctomb (char *s, wchar_t wchar);
  117. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  118. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  119.  
  120.  
  121. #ifdef __cplusplus
  122. }
  123. #endif
  124.  
  125. #endif
  126.